package com.itqf.servie;

import com.itqf.execption.UserLoginExecption;
import com.itqf.pojo.User;

import java.util.HashMap;
import java.util.Map;

/**
 * projectName: springmvcgp8
 *
 * @author: 赵伟风
 * time: 2021/8/6 16:35
 * description:
 */
public class UserService {

    public Map<String,Object> login(String username, String password) throws UserLoginExecption {

        Map<String,Object> map = new HashMap<>();

        if (username == null || password == null){

            map.put("state", 1);
            return map;
        }

        if(username != "root"){

            map.put("state", 2);
            return map;
        }

        if (password != "123")
        {
            map.put("state", 3);
            return map;
        }

        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        user.setSex("男");

        map.put("state", 4);
        map.put("user", user);

        return map;
    }

}
